<?php
namespace app\admin\validate;
use think\Validate;

/**
 * 工作记录工作云盘信息验证器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/10/30
 * Time: 15:32
 */
class WorkRecordCloud extends Validate{

    protected $rule = [
        'name'        => 'require',
        'size'        => 'require|integer|gt:0',
        'url'         => 'require',
        'parentid'    => 'require',
        'is_password' => 'require'
    ];

    protected $message = [
        'name.require'        => '文件名必须填写',
        'size.require'        => '大小必须填写',
        'size.integer'        => '大小填写错误',
        'size.gt'             => '大小填写错误',
        'url.require'         => '地址必须填写',
        'parentid.require'    => '上级目录必须填写',
        'is_password.require' => '是否加密必须填写',
    ];

    protected $scene = [
        'add_file'    => ['name','size','url','parentid'],
        'edit_file'   => ['name','size','url','parentid'],
        'add_folder'  => ['name','parentid','is_password'],
        'edit_folder' => ['name','is_password']
    ];
}